<template>
	<view id="WorkOrderEvaluation">
		<text>服务您还满意吗</text>
		<text>给维修师傅的工作一点评价吧~</text>
		<view class="public">
			<text>完成质量</text>
			<textarea placeholder="请输入" v-model="data.completion_quality" />
		</view>
		<view class="public">
			<text>响应速度</text>
			<textarea placeholder="请输入" v-model="data.corresponding_speed" />
		</view>
		<view class="public">
			<text>维修进度</text>
			<textarea placeholder="请输入" v-model="data.wei_speed" />
		</view>
		<uni-rate v-model="data.grade_num" size="60" />
		<button @click="Ti">提交</button>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		request
	} from '@/unit/request.js'
	let rateValue = ref(3)
	let data=ref({
		grade_num:1
	})
	const Ti=()=>{
		request({
			url: "http://42.192.15.126:3000/yan/grades?id=" + id.value,
			method: 'POST',
			data:{...data.value}
		}).then(item => {
			request({
				url: "http://42.192.15.126:3000/yan/work_update?id=" + id.value + '&num=4',
				method: 'PUT'
			}).then(items => {
				console.log(items);
				uni.navigateTo({
					url:"/pages/work-order-management/work-order-query/work-order-query"
				})
			})
		})
	}
	const id=ref()
	onLoad((option) => {
		id.value = option._id
	})
	
</script>

<style lang="scss">
	#WorkOrderEvaluation {
		height: calc(100vh - 44px);
		padding: 20rpx;
		background-color: #f4f6f9;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;

		>:first-child {
			margin-bottom: 20rpx;
			color: #ff6600;
			font-size: 60rpx;
		}

		.public {
			width: 100%;
			border-top: 2rpx solid #e2e4e7;
			border-bottom: 2rpx solid #e2e4e7;
			background-color: white;
			margin-top: 20rpx;
			padding: 10rpx;
			box-sizing: border-box;

			textarea {
				width: 100%;
			}
		}

		button {
			width: 30vw;
			background-color: #3366ff;
			color: white;
			margin-top: 20rpx;
		}
	}
</style>